'
'
'  ROSC
'
' Robot Operating System Constants
'
' Like a header file this can be included in every file.
'

CON
  MAX_SERVOS = 12
  MAX_GAITS  = 4
  MAX_THREADS = 5
  MAX_DECKS = 10
  STACK_SIZE = 512

  ' For the thread loop
  NO_STATE     = %0000
  FORWARD_GAIT_CARD = %0001
  LEFT_TURN_CARD    = %0010
  RIGHT_TURN_CARD   = %0100
  SENSOR_READ_CARD  = %1000
  TIMER_CARD


  ' joint identification
  LEFT  = %00000001
  RIGHT = %00000010
  FRONT = %00000100
  REAR =  %00001000
  HORIZ = %00010000
  VERT =  %00100000
  FIRST =  %01000000
  SECOND = %10000000
  THIRD = %110000000

  ALL_FUNC=%1111_0000_0000_0000
  CLAMP_FUNC=%0001_0000_0000_0000
  STATIC_MID_FUNC=%0010_0000_0000_0000
  STATIC_LOW_FUNC=%0011_0000_0000_0000
  STATIC_HIGH_FUNC=%0100_0000_0000_0000
  COS_FUNC= %0101_0000_0000_0000
  SIN_FUNC= %0110_0000_0000_0000


  ' Gait phases
  GAIT_PHASE1 = %0001_0000_0000_0000
  GAIT_PHASE2 = %0010_0000_0000_0000
  GAIT_PHASE3 = %0100_0000_0000_0000
  GAIT_PHASE4 = %1000_0000_0000_0000
  GAIT_PHASE_ALL= %1111_0000_0000_0000

  ' for stick control
  LEFT_FWD = %0010
  RIGHT_FWD = %0001      
  DIR_FWD   = %0011
  DIR_BWD  = %1100
  LEFT_BWD = %1000
  RIGHT_BWD = %0100

  ANY_RIGHT_DIR = %0101
  ANY_LEFT_DIR = %1010

  ' for EEPROM
  MEM_START = $8000
  MEM_PIN_TYPES = $8000+192  'far away to be safe
  PAGE_SIZE = 32

  BAD_WRITE = 1


  ' Pin identification
  PIN_SERVO = %0001_0000 ' so you can hav 16 of them
  PIN_RX    = %0010_0000  ' 16
  PIN_PING  = %0011_0000
  PIN_COLOR = %0100_0000
  PIN_TV    = %0101_0000
  PIN_SER_RX = %0110_0000
  PIN_SER_TX = %0111_0000
  PIN_UNUSED = 0

  MAX_PIN_COUNT = 32
  
PUB Main